package p270jp.pxv.android.model;

import android.content.Context;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import p060c2.Chain;
import p270jp.pxv.android.R;
import p325m0.MutabilityOwnership;
import p629xm.Iterators;

/* compiled from: SearchBookmarkRangeListConverter.kt */
/* renamed from: jp.pxv.android.model.SearchBookmarkRangeListConverter */
/* loaded from: classes2.dex */
public final class SearchBookmarkRangeListConverter {
    public static final int $stable = 8;
    private final List<SearchBookmarkRange> bookmarkRangeList;
    private final Context context;

    public SearchBookmarkRangeListConverter(Context context, List<SearchBookmarkRange> list) {
        MutabilityOwnership.m3745m(context, "context");
        MutabilityOwnership.m3745m(list, "bookmarkRangeList");
        this.context = context;
        this.bookmarkRangeList = list;
    }

    public final String createItemLabel(SearchBookmarkRange searchBookmarkRange) {
        MutabilityOwnership.m3745m(searchBookmarkRange, "searchBookmarkRange");
        if (searchBookmarkRange.isRangeAll()) {
            String string = this.context.getString(R.string.search_liked_count_all);
            MutabilityOwnership.m3746l(string, "context.getString(jp.pxv…g.search_liked_count_all)");
            return string;
        } else if (searchBookmarkRange.isRangePatternOver()) {
            String string2 = this.context.getString(R.string.search_liked_count_over, searchBookmarkRange.getBookmarkNumMin());
            MutabilityOwnership.m3746l(string2, "context.getString(\n     …kNumMin\n                )");
            return string2;
        } else {
            String string3 = this.context.getString(R.string.search_liked_count_between, searchBookmarkRange.getBookmarkNumMin(), searchBookmarkRange.getBookmarkNumMax());
            MutabilityOwnership.m3746l(string3, "context.getString(\n     …kNumMax\n                )");
            return string3;
        }
    }

    public final ArrayList<SingleChoiceListValue> createSingleChoiceListValues() {
        ArrayList<SingleChoiceListValue> arrayList = new ArrayList<>();
        Iterator<Integer> it = Chain.m9936n(this.bookmarkRangeList).iterator();
        while (it.hasNext()) {
            int c = ((Iterators) it).mo677c();
            arrayList.add(new SingleChoiceListValue(c, createItemLabel(this.bookmarkRangeList.get(c))));
        }
        return arrayList;
    }

    public final int getIndex(SearchBookmarkRange searchBookmarkRange) {
        MutabilityOwnership.m3745m(searchBookmarkRange, "searchBookmarkRange");
        Iterator<Integer> it = Chain.m9936n(this.bookmarkRangeList).iterator();
        while (it.hasNext()) {
            int c = ((Iterators) it).mo677c();
            if (MutabilityOwnership.m3749h(this.bookmarkRangeList.get(c), searchBookmarkRange)) {
                return c;
            }
        }
        return 0;
    }

    public final SearchBookmarkRange getSearchBookmarkRangeByIndex(int i) {
        return this.bookmarkRangeList.get(i);
    }
}
